package com.software.loginregister.api;

import com.software.loginregister.entity.ChatHistoryMessage;
import com.software.loginregister.entity.ChatMessage;
import com.software.loginregister.entity.ConversationHistory;
import com.software.loginregister.entity.MessageResponse;
import com.software.loginregister.entity.Result;

import java.util.List;
import java.util.Map;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface ChatApi {
    @POST("/api/chat/send")
    Call<ResponseBody> sendMessage(@Body Map<String, String> message);

    @GET("/api/chat/conversations")
    Call<List<ConversationHistory>> getConversationHistory(
            @Query("userId") String userId,
            @Query("appId") String appId,
            @Query("lastId") String lastId,
            @Query("limit") int limit
    );

    @DELETE("api/chat/conversations")
    Call<ResponseBody> deleteConversation(
            @Query("userId") String userId,      // 调整顺序，先传 userId
            @Query("appId") String appId,        // 然后是 appId
            @Query("conversationId") String conversationId  // 最后是 conversationId
    );

    @GET("api/chat/conversations/messages")
    Call<List<ChatHistoryMessage>> getMessages(
            @Query("userId") String userId,
            @Query("appId") String appId,
            @Query("conversationId") String conversationId,
            @Query("limit") int limit
    );
}